<html>
<head><meta charset="utf-8"><title>unused type param cg suggestion · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/unused.20type.20param.20cg.20suggestion.html">unused type param cg suggestion</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233500878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/unused%20type%20param%20cg%20suggestion/near/233500878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/unused.20type.20param.20cg.20suggestion.html#233500878">(Apr 07 2021 at 14:48)</a>:</h4>
<p>for the following snippet:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">N</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
</code></pre></div>
<p>we currently emit the following error:</p>
<div class="codehilite"><pre><span></span><code>error[E0392]: parameter `N` is never used
 --&gt; src/lib.rs:1:12
  |
1 | struct Foo&lt;N&gt;;
  |            ^ unused parameter
  |
  = help: consider removing `N`, referring to it in a field, or using a marker such as `PhantomData`
</code></pre></div>
<p>do we want to add "help: if you intended <code>N</code> to be a const parameter, use <code>const N: usize</code> instead" to that error message? I've seen a few people using type param syntax when first experimenting with const generics and being confused</p>



<a name="233546820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/unused%20type%20param%20cg%20suggestion/near/233546820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/unused.20type.20param.20cg.20suggestion.html#233546820">(Apr 07 2021 at 19:23)</a>:</h4>
<p>Yes, that's a good idea <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="236944679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/unused%20type%20param%20cg%20suggestion/near/236944679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/unused.20type.20param.20cg.20suggestion.html#236944679">(May 01 2021 at 06:53)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/84784">https://github.com/rust-lang/rust/pull/84784</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>